<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head lang="en">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta charset="UTF-8">
    <title>table模块快速使用</title>
<link rel="stylesheet" th:href="@{/layui.2.2.3/layui/css/layui.css}" media="all"/>
</head>
<body>

<table id="demo" lay-filter="test"></table>

<script type="text/javascript" th:src="@{/layui.2.2.3/layui/layui.js}"></script>
<script>
    layui.use('table', function(){
        var table = layui.table;
        table.render({
            elem: '#demo'
            ,height: 312
            ,url: '/spring-boot/user/listPage'
            ,page: true
            ,cols: [
                [
                {field: 'name', title: '姓名', width:'10%', sort: true, fixed: 'left'}
                ,{field: 'sex', title: '性别', width:'10%'}
                ,{field: 'age', title: '年龄', width:'10%', sort: true}
                ,{field: 'mobile', title: '号码', width:'20%'}
                ,{field: 'createTime', title: '创建时间', width: '20%', templet: "<div>{{layui.util.toDateString(d.createTime, 'yyyy-MM-dd HH:mm:ss')}}</div>"}
                ,{field: 'updateTime', title: '更新时间', width: '20%', sort: true, templet: "<div>{{layui.util.toDateString(d.updateTime, 'yyyy-MM-dd HH:mm:ss')}}</div>"}
            ]
            ]
        });
    });
</script>
</body>
</html>